Open
Conversation
Extends fillField in Playwright, Puppeteer, and WebDriver helpers to detect and fill rich text editors automatically. Works with contenteditable, hidden-textarea, and iframe-based editors — verified against ProseMirror, Quill, CKEditor 4/5, TinyMCE inline/legacy, CodeMirror 5/6, Monaco, ACE, Trix, and Summernote. Detection and filling logic is centralized in lib/helper/extras/richTextEditor.js and built on new WebElement primitives (evaluate, focus, typeText, selectAllAndDelete, inIframe), so all three helpers share one implementation. Adds 48 rich text scenarios to the shared webapi.js test suite (4 scenarios × 12 editors) covering basic fill, rewriting pre-populated content, special-character preservation, and large multi-paragraph content. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
webdriverio keys() lives on browser, not element. Route typeText and selectAllAndDelete through helper.browser.keys() for the WebDriver path so rich-text scenarios (hidden-textarea + iframe editors) work. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Use switchFrame() instead of removed switchToFrame/switchToParentFrame. Split typed text on \n and emit Enter keypress (\uE007) between segments so multi-paragraph content reaches Trix and other keystroke-driven editors. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
selectAllInEditable already focuses the body via JS; the extra click was only there to mimic Playwright's force-click semantics. In WebDriver the click resolved viewport coords through the iframe, so CKEditor 4's parent-scope notification overlay intercepted it. Removing the click makes all 48 iframe tests pass in WebDriver without affecting Playwright or Puppeteer. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
DenysKuchma
requested changes
Apr 20, 2026
| HIDDEN_TEXTAREA: 'hidden-textarea', | ||
| } | ||
|
|
||
| function detectAndMark(el, opts) { |
Collaborator
There was a problem hiding this comment.
Looks too broad for hidden elements: it climbs up to document.body and can accidentally bind an unrelated hidden field to any editor on the page
The hidden-element fallback in detectAndMark used to climb to document.body looking for a nearby editor, so calling fillField on an unrelated hidden input could accidentally bind it to any editor on the same page. Cap the ancestor walk at 3 levels (covers CKE4 / Summernote / TinyMCE-legacy wrapper depth of 1-2 with margin) and skip the walk entirely for <input type=\"hidden\"> since those are form-state inputs, not editor-backing elements. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fillFieldin Playwright, Puppeteer, and WebDriver helpers to detect and fill rich text editors automatically — no per-editor selectors hardcoded<input>/<textarea>stays on the original fast pathlib/helper/extras/richTextEditor.js; cross-helper primitives (evaluate,focus,typeText,selectAllAndDelete,inIframe) added toWebElementso a single implementation serves all three helperstest/helper/webapi.js(4 scenarios × 12 editors) — fill, rewrite pre-populated content, preserve special characters, fill multi-paragraph content — automatically exercised by Playwright/Puppeteer/WebDriver helper test suitesTest plan
BROWSER=chromium node_modules/.bin/mocha test/helper/Playwright_test.js --grep "rich text editors"— 48/48 passingwebApiTests.tests()webApiTests.tests()🤖 Generated with Claude Code